﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Server.Kestrel.Https;
using System.Reflection;
using Autofac.Extensions.DependencyInjection;
using NLog.Web;
using NLog;
using NLog.Web.AspNetCore;
using System.Net;

namespace chihuopig.Web
{
    public class Program
    {
        
        public static void Main(string[] args){
            
            BuildWebHost(args).Run();
         
        }

        public static IWebHost BuildWebHost(string[] args)=> 
              WebHost.CreateDefaultBuilder(args)
                            .UseStartup<Startup>()
                           .UseKestrel(option=> 
                            {
                                //设置Https
                                option.Listen(System.Net.IPAddress.Any, 81, configure =>
                                {
                                    configure.UseHttps("chihuopig.club.pfx", "hu19950730");
                                });
                             })
                             //.UseUrls("http://*:81")
                            .UseContentRoot(Directory.GetCurrentDirectory())
                            .ConfigureServices(Services => Services.AddAutofac())
                            //.UseIISIntegration()
                            //.UseContentRoot(Directory.GetCurrentDirectory())
                            .Build();

        
           
     
    }
}
